<?php
include("../common/conn.php");
// 需传参数
$id = $_REQUEST[id];
// 需传参数 end

// 状态 
$state3 = 3; 
$state4 = 4; 
$state5 = 5; 
// 状态 end

$query = mysql_query("UPDATE tuihuo set state=".$state5." where id=".$id." and state=".$state5);

// 返回退货前状态 
$query = mysql_query("select ordersid,orderstate from tuihuo where id=".$id." and state=".$state3);
$tuihuo = mysql_fetch_assoc($query);
$ordersid = $tuihuo['ordersid'];
$orderstate = $tuihuo['orderstate'];

$query = mysql_query("UPDATE goodsorders set state = ".$orderstate." where ordersid=".$ordersid);
$query = mysql_query("DELETE from tuihuo where id = ".$id." and state=".$state3);
// 返回退货前状态 end